
package com.kweative.cluster;

import java.io.Serializable;

/**
 *
 * @author henrik
 */
public class Action implements Serializable {
    private ActionType type;
    private Serializable object;
    private String key;
    private ClusterNode receiver = null;
    public Action(ActionType type, Serializable object, String key) {
        this.type = type;
        this.object = object;
        this.key = key;
    }

    public Action(ActionType type, Serializable object, String key,ClusterNode receiver) {
        this.type = type;
        this.object = object;
        this.key = key;
        this.receiver = receiver;
    }

    public ClusterNode getReceiver() {
        return receiver;
    }

    public String getKey() {
        return key;
    }

    public Serializable getObject() {
        return object;
    }

    public ActionType getType() {
        return type;
    }
    public enum ActionType {
        NONE,
        UPDATE,
        DELETE,
        INSERT,
        RETRIEVE,
        GREET,
        MEET,
        LEAVE,
        SETMASTER,
        INIT
    }
}
